﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Zone;
using Microsoft.Win32;
using System.Threading;

namespace SmsSend
{
    public partial class MainFm : Form
    {
        Version AppVersion = new Version(Application.ProductVersion);
        HttpClient webClient = new HttpClient();
        Func2 fun2 = new Func2();
        string UserInfo = "";
        public MainFm(HttpClient httpClient)
        {           
            InitializeComponent();            
            webClient = httpClient;
            GetUserInfo();
        }
        void GetUserInfo()
        {
            string ss2 = (new WebClient_LoadWeb()).JspGBK(Init_GlobalSetting.wwwAddress + "admin/top.jsp", ref webClient); ss2 = ss2.Replace("\r", ""); ss2 = ss2.Replace("\n", "");
            string ss3 = fun2.RegexMatch(ss2, "用户.+</TD>"); ss3 = ss3.Replace("</TD>", ""); ss3 = ss3.Replace("&nbsp;", " ");
            label1.Text = ss3;

        }
        private void MainFm_Load(object sender, EventArgs e)
        {                                    
            ruanjianbanben_label.Text = "软件版本 " + AppVersion + "   客服电话：400-88-55513 广东普天科技信息有限公司版权所有";
            webBrower1.ScriptErrorsSuppressed = false;
            gonggao_picbox_Click(null, null);
        }
        void ShowYongHuMing()
        {            
                  
        }             
        private void xiugaimima_btn_Click(object sender, EventArgs e)
        {
            SmsClass.SetWebBrowerCookie(Init_GlobalSetting.wwwAddress + "sms/updatepwd.jsp", ref webBrower1);
            return;
        }       
        private void chongzhijilu_btn_Click(object sender, EventArgs e)
        {
        }               
        void CloseWindow()
        {
            if ((MessageBox.Show("是否退出系统？", "", MessageBoxButtons.YesNo) == DialogResult.Yes))
            {
                this.Close();
                Environment.Exit(0);
            }
        }
        private void putongduanxinfasong_btn_Click(object sender, EventArgs e)
        {
           
        }

        private void jingzhudunxinfasong_btn_Click(object sender, EventArgs e)
        {
           
        }

        private void jingzhunyoujianfasong_btn_Click(object sender, EventArgs e)
        {
           
        }

        private void MainFm_FormClosing(object sender, FormClosingEventArgs e)
        {
            //if (MessageBox.Show(
            //            "窗口关闭后，数据即将丢失！是否现在关闭窗口",
            //            "提示",
            //            MessageBoxButtons.OKCancel,
            //            MessageBoxIcon.Question) != DialogResult.OK)
            //{
            //    e.Cancel = true;
            //}
            //else
            //{
            //    Environment.Exit(0);
            //}
        }               
        private void gonggao_picbox_Click(object sender, EventArgs e)
        {
            SmsClass.SetWebBrowerCookie(Init_GlobalSetting.wwwAddress + "admin/main.jsp", ref webBrower1);
            return;
        }       
       
        private void jingzhunduanxin_picbox_Click(object sender, EventArgs e)
        {
            SmsClass.SetWebBrowerCookie(Init_GlobalSetting.wwwAddress + "jingzhun/jzsms.jsp", ref webBrower1);///                        
            return;
        }

        private void JingZhunYouJian_PicBox_Click(object sender, EventArgs e)
        {
            SmsClass.SetWebBrowerCookie(Init_GlobalSetting.wwwAddress + "email/emailsong.jsp", ref webBrower1);///                        
            return;
        }

        private void TuiChuXiTong_PicBox_Click(object sender, EventArgs e)
        {
            CloseWindow();
        }

        private void XiuGaiMiMa_PicBox_Click(object sender, EventArgs e)
        {
            SmsClass.SetWebBrowerCookie(Init_GlobalSetting.wwwAddress + "sms/updatepwd.jsp", ref webBrower1);
            return;
        }

        private void ChongZhiJiLu_PicBox_Click(object sender, EventArgs e)
        {
            SmsClass.SetWebBrowerCookie(Init_GlobalSetting.wwwAddress + "sms/chongzhijilu.jsp", ref webBrower1);
            return;
        }

        private void FaSongJiLu_PicBox_Click(object sender, EventArgs e)
        {
            SmsClass.SetWebBrowerCookie(Init_GlobalSetting.wwwAddress + "sms/qunfajilu.jsp", ref webBrower1);
            return;
        }

        private void TongXunLu_PicBox_Click(object sender, EventArgs e)
        {
            SmsClass.SetWebBrowerCookie(Init_GlobalSetting.wwwAddress + "txl/waibutxl.jsp", ref webBrower1);
            return;
        }

        private void PuTongDuanXin_PicBox_Click(object sender, EventArgs e)
        {
            SmsClass.SetWebBrowerCookie(Init_GlobalSetting.wwwAddress + "sms/jzsms.jsp", ref webBrower1);///                        
            DebugNew.DebugMethod(Init_GlobalSetting.wwwAddress + "sms/jzsms.jsp");
            return;
        }
        private void gonggao_picbox_MouseHover(object sender, EventArgs e)
        {
            gonggao_picbox.Image = Properties.Resources.pcnav_hover_1;
        }
        private void gonggao_picbox_MouseLeave(object sender, EventArgs e)
        {

            gonggao_picbox.Image = Properties.Resources.pcnav_1;
        }       
        private void PuTongDuanXin_PicBox_MouseHover(object sender, EventArgs e)
        {
            PuTongDuanXin_PicBox.Image = Properties.Resources.pcnav_hover_2;
        }

        private void PuTongDuanXin_PicBox_MouseLeave(object sender, EventArgs e)
        {
            PuTongDuanXin_PicBox.Image = Properties.Resources.pcnav_2;
        }

        private void jingzhunduanxin_picbox_MouseHover(object sender, EventArgs e)
        {
            jingzhunduanxin_picbox.Image = Properties.Resources.pcnav_hover_3;
        }

        private void jingzhunduanxin_picbox_MouseLeave(object sender, EventArgs e)
        {
            jingzhunduanxin_picbox.Image = Properties.Resources.pcnav_3;
        }

        private void JingZhunYouJian_PicBox_MouseHover(object sender, EventArgs e)
        {
            JingZhunYouJian_PicBox.Image = Properties.Resources.pcnav_hover_4;
        }

        private void JingZhunYouJian_PicBox_MouseLeave(object sender, EventArgs e)
        {
            JingZhunYouJian_PicBox.Image = Properties.Resources.pcnav_4;
        }

        private void TongXunLu_PicBox_MouseHover(object sender, EventArgs e)
        {
            TongXunLu_PicBox.Image = Properties.Resources.pcnav_hover_9;
        }

        private void TongXunLu_PicBox_MouseLeave(object sender, EventArgs e)
        {
            TongXunLu_PicBox.Image = Properties.Resources.pcnav_9;
        }

        private void FaSongJiLu_PicBox_MouseHover(object sender, EventArgs e)
        {
            FaSongJiLu_PicBox.Image = Properties.Resources.pcnav_hover_5;
        }

        private void FaSongJiLu_PicBox_MouseLeave(object sender, EventArgs e)
        {
            FaSongJiLu_PicBox.Image = Properties.Resources.pcnav_5;
        }

        private void ChongZhiJiLu_PicBox_MouseHover(object sender, EventArgs e)
        {
            ChongZhiJiLu_PicBox.Image = Properties.Resources.pcnav_hover_6;
        }

        private void ChongZhiJiLu_PicBox_MouseLeave(object sender, EventArgs e)
        {
            ChongZhiJiLu_PicBox.Image = Properties.Resources.pcnav_6;
        }

        private void XiuGaiMiMa_PicBox_MouseHover(object sender, EventArgs e)
        {
            XiuGaiMiMa_PicBox.Image = Properties.Resources.pcnav_hover_7;
        }

        private void XiuGaiMiMa_PicBox_MouseLeave(object sender, EventArgs e)
        {
            XiuGaiMiMa_PicBox.Image = Properties.Resources.pcnav_7;
        }

        private void TuiChuXiTong_PicBox_MouseHover(object sender, EventArgs e)
        {
            TuiChuXiTong_PicBox.Image = Properties.Resources.pcnav_hover_8;
        }

        private void TuiChuXiTong_PicBox_MouseLeave(object sender, EventArgs e)
        {
            TuiChuXiTong_PicBox.Image = Properties.Resources.pcnav_8;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            GetUserInfo();
        }        
    }
}
